/**
 * Created by Eoly on 2016/12/31.
 */
function Model() {

    this.src = null;
    this.size = null;
    this.radius = null;
    this.faceDeg = 0;
    this.isFaceDeg = false;

    this.init = function () {
        this.src = "img/plane.png";
        this.size = 0.07;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };

    this.init();
}

Model.prototype = {
    preImg: function (callback) {
        var _this = this;
        if (this.img.complete) {
            callback.call(this.img);
            return;
        }
        this.img.onload = function () {
            callback.call(_this.img);
        };
    }
};

function BulletModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/bullet.png";
        this.size = 0.010;
        this.img = new Image();
        this.isFaceDeg = true;
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,BulletModel);

function EnemyModel() {
    this.init = function () {
        this.src = "img/enemy.png";
        this.size = 0.07;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,EnemyModel);

function RayBulletModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/S_LASRE.png";
        this.size = 0.015;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,RayBulletModel);

function EnemyBulletModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/PLCHFLMC.png";
        this.size = 0.010;
        this.img = new Image();
        this.isFaceDeg = true;
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,EnemyBulletModel);

function GivingRandomModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/Random.png";
        this.size = 0.07;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,GivingRandomModel);

function GivingShotModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/Shot.png";
        this.size = 0.07;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,GivingShotModel);

function GivingRandomSModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/RandomS.png";
        this.size = 0.07;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,GivingRandomSModel);

function GivingFollowModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/final.png";
        this.size = 0.07;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,GivingFollowModel);


function GivingRayModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/Ray.png";
        this.size = 0.07;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,GivingRayModel);

function GivingDefenseModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/defense.png";
        this.size = 0.07;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,GivingDefenseModel);

function DefenseModel() {
    Model.call(this);
    this.init = function () {
        this.src = "img/S_PSHOT2C.png";
        this.size = 0.007;
        this.img = new Image();
        this.img.src = this.src;
        this.radius = window.innerWidth*this.size*0.5;
    };
    this.init();
}
Extend(Model,DefenseModel);